<?php

class Application_Model_DbTable_Shop extends Zend_Db_Table_Abstract
{

    protected $_name = 'txy_shop';

	public function addNewShop(Array $data){
		$this->insert($data);
	}
	
	public function getUnConvertedShop(){
		$res=$this->fetchAll("url_spell is null or url_spell=''");
		return $res->toArray();
	}
	
	public function updateConvertedShop($data,$sid){
		$this->update($data, "sid=".$sid);
	}
	public function getShopBySid($sid){
		$id=(int)$sid;
    	$row=$this->fetchRow('sid = '.$id);
    	if(!$row){
    		throw new Exception("没有对应的店铺");
    	}
    	return $row;
	}
	
	public function getShopByUrl($url){
	    $url=trim($url);
	    $row=$this->fetchRow("url_spell = '".$url."'");
    	if(!$row){
    		throw new Exception("没有对应的店铺");
    	}
    	return $row;
	}
	
}

